<!DOCTYPE html>
<meta charset="UTF-8">
<title>getComputedTextLength() with arabic script</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<svg width="50px" height="60px" font-family="Arial" font-size="30px">
  <text id="ltrtext" y="30">إعلانات</text>
  <text id="rtltext" y="60" direction="rtl">إعلانات</text>
  <text id="ltrspace"><tspan>نه</tspan>  با</text>
  <text id="rtlspace" direction="rtl"><tspan>نه</tspan>  با</text>
</svg>
<script>
test(function() {
  var textElementLtr = document.getElementById("ltrtext");
  var textElementRtl = document.getElementById("rtltext");

  var widthLtr = textElementLtr.getComputedTextLength();
  var widthRtl = textElementRtl.getComputedTextLength();

  assert_equals(widthLtr, widthRtl);
}, 'Direction does not affect computed text length.');

test(function() {
  var textElementLtr = document.getElementById("ltrspace");
  var textElementRtl = document.getElementById("rtlspace");

  var widthLtr = textElementLtr.getComputedTextLength();
  var widthRtl = textElementRtl.getComputedTextLength();

  assert_equals(widthLtr, widthRtl);
}, 'Direction does not affect computed text length - whitespace.');
</script>
